package com.cy.interfacetest.activity;

import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;

import androidx.annotation.RequiresApi;

import com.cy.interfacetest.R;
import com.cy.interfacetest.policyinterface.IPolicyManager;
import com.cy.interfacetest.policyinterface.impl.IPolicyManagerImpl;
import com.cy.interfacetest.proxy.ModuleProxy;

import ga.mdm.PolicyManager;

@RequiresApi(api = Build.VERSION_CODES.N)
public class DeviceInfoActivity extends BaseActivity {
    private static final String TAG = "DeviceInfoActivity";
    private static IPolicyManager pm = new ModuleProxy<IPolicyManager>().getInstance(new IPolicyManagerImpl(PolicyManager.getInstance()));

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_device_info);

        findViewById(R.id.getTpmReport).setOnClickListener(v -> {
            Toast.makeText(this, pm.getTpmReport(), Toast.LENGTH_SHORT).show();
        });

        findViewById(R.id.getSystemIntegrity).setOnClickListener(v -> {
            Toast.makeText(this, pm.getSystemIntegrity() ? "可信" : "不可信", Toast.LENGTH_SHORT).show();
        });
    }

}